package com.ejd.web.vo.goods.shoes;

import javax.faces.bean.ManagedBean;


import javax.faces.bean.SessionScoped;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpSession;

import com.ejd.service.IApplyService;
import com.ejd.utils.DESPlusUtil;
import com.ejd.utils.GoodsUtil;
import com.ejd.utils.SpringFacesUtil;
import com.ejd.web.bo.impl.Apply;
import com.ejd.web.constant.EjdConstants;
import com.ejd.web.constant.SpringBeanConstants;
@ManagedBean(name="listGirlShoesPage")
@SessionScoped
public class ListGirlShoesPageBean extends ListShoesPageBean implements java.io.Serializable {
	private static final long serialVersionUID = -8106629465344224726L;
	private String sessionId;
	
	
	public String getSessionId() {
		return sessionId;
	}


	public void setSessionId(String sessionId) {
		this.sessionId = sessionId;
	}


	public ListGirlShoesPageBean(){
		String[] tempApplys = new String[1];
		tempApplys[0] = EjdConstants.APPLY_GIRL;
		this.setApplys(tempApplys);
		//this.setApplyItems(this.initApply());
		this.setBrandCodeItems(this.initBrandCodes());
		this.setSecondCategoryItems(this.initSecondCategory());
		this.setMaterialItems(this.initMaterial());
		this.setLiningItems(this.initLining());
		this.setClassesItems(this.initClasses());
		this.setStyleItems(this.initStyle());
		this.setBasemetalItems(this.initBasemetal());
		
		this.setDefaultHql("from Goods where primaryCategoryCode='shoes' and status='A' ");
		this.setHql(this.getDefaultHql());
		this.setPageNo(1);
		this.setPriceBetween("N");
		this.setSortStyle("NO");
		this.generateHQL(this.getDefaultHql());
		this.getPageDatas();
		String sessionId = SpringFacesUtil.getCurrentSessionId();
		sessionId = DESPlusUtil.encrypt(sessionId);
		this.setSessionId(sessionId);
		//set session id for view goods detail , by judge new session and the same session for jing zhi dou dao shu ju
		
		// for show data
		String specSql = " and sfield1 = 'girl' ";
		this.setPromotionGoods(GoodsUtil.getGoods(specSql, EjdConstants.PRIMARY_CATEGORY_CODE_SHOES, "%" + EjdConstants.SHOW_ON_PROMOTION + "%",3));
		this.setHotGoods(GoodsUtil.getGoods(specSql, EjdConstants.PRIMARY_CATEGORY_CODE_SHOES, "%" + EjdConstants.SHOW_ON_HOT + "%", 3));
		this.setRecommendGoods(GoodsUtil.getGoods(specSql, EjdConstants.PRIMARY_CATEGORY_CODE_SHOES, "%" +EjdConstants.SHOW_ON_RECOMMEND + "%", 3));
		//end
	}
	public String unSelectAll() {
		
		
		if (null != this.getBrandCodes()) {
			this.setBrandCodes(new String[]{""});
		} else {
			this.getBrandCodes()[0] = "";
		}
		
		if (null != this.getSecondCategories()) {
			this.setSecondCategories(new String[]{""});
		} else {
			this.getSecondCategories()[0] = "";
		}
		
		if (null != this.getMaterials()) {
			this.setMaterials(new String[]{""});
		} else {
			this.getMaterials()[0] = "";
		}
		
		if (null != this.getLinings()) {
			this.setLinings(new String[]{""});
		} else {
			this.getLinings()[0] = "";
		}
		
		if (null != this.getClasses()) {
			this.setClasses(new String[]{""});
		} else {
			this.getClasses()[0] = "";
		}
		
		if (null != this.getStyles()) {
			this.setStyles(new String[]{""});
		} else {
			this.getStyles()[0] = "";
		}
		
		if (null != this.getBasemetals()) {
			this.setBasemetals(new String[]{""});
		} else {
			this.getBasemetals()[0] = "";
		}
		
		reInitAllProperties();
		this.generateHQL(this.getDefaultHql());
		this.getPageDatas();

		return null;
	}
}
